// 这个写法 webpack打包的时候 是按需加载
const Home = () => import( /* webpackChunkName: "home" */ '@/views/Home')
const Login = () => import( /* webpackChunkName: "login" */ '@/views/Login')
const Foo = () => import( /* webpackChunkName: "foo" */ '@/views/Foo')
const Bar = () => import( /* webpackChunkName: "bar" */ '@/views/Bar')

const routes = [{
    path: "",
    redirect: "/home"
  },
  {
    path: "/home",
    component: Home,
    meta: {
      // 证明 用户访问该组件的时候需要登录
      requireAuth: true
    }
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/foo',
    component: Foo
  },
  {
    path: '/bar',
    component: Bar,
    meta: {
      // 证明 用户访问该组件的时候需要登录
      requireAuth: true
    }
  }
]

export default routes
